<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>选择你喜欢的鼠标</title>
    <style>
        *{font-size: 16px; font-family: "Arial", "微软雅黑"; line-height: 25px;}
        div{
            padding: 5px; text-align: center;
            width: 300px;
            display: inline;
        }
        img{
            width: 300px;
        }
        div span{display: block;}
        .mouse-title{
            font-size: 20px;
        } 
    </style>
</head>
<body>
        <p> <span class="mouse-title">选择你喜欢的鼠标：</span> <br><input type="radio" name="mouse" onclick="mouse()">罗技——轨迹球<br> <input type="radio" name="mouse" onclick="mouse()">雷蛇——游戏鼠</p>
<div></div>
<script>
    function mouse(){
        var ele=document.getElementsByName("mouse");
        var bName=document.getElementsByTagName("div")[0];
        if(ele[0].checked){
            var img=document.createElement("img");
            img.setAttribute("src","images/gj.jpg");
            img.setAttribute("alt","罗技——轨迹球");
            bName.appendChild(img);
        }
        else if(ele[1].checked){
            var img=document.createElement("img");
            img.setAttribute("src","images/ls.jpg");
            img.setAttribute("alt","雷蛇——游戏鼠");
            img.setAttribute("onclick","copyNode()")
            bName.appendChild(img);
        }
    }
    function copyNode(){
        var bName=document.getElementsByTagName("div")[0];
        var copy=bName.lastChild.cloneNode(false);
        bName.insertBefore(copy,bName.firstChild);
    }

</script>
</body>
</html>